
package de.midnightdance.admin.ws.entities;

import java.beans.PropertyChangeSupport;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;

import de.cbf.util.ui.editentities.interfaces.IEditableEntity;
import de.midnightdance.admin.ws.entities.UuidHeader;


/**
 * <p>Java class for ritual complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="ritual">
 *   &lt;complexContent>
 *     &lt;extension base="{http://service.server.midnightdance.de/}uuidHeader">
 *       &lt;sequence>
 *         &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/extension>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ritual", propOrder = {
	"name",
	"notizen"	
})
public class Ritual
    extends UuidHeader implements IEditableEntity
{
	public static final int PCE_INDEX_Name 		= 1;
	public static final int PCE_INDEX_Notizen 	= 2;


    protected String name;
    protected String notizen;
    @XmlTransient
    protected PropertyChangeSupport propertyChangeSupport;

    public Ritual() {
		super();
		propertyChangeSupport = new PropertyChangeSupport(this);
		name 	= "";
		notizen = "";
	}
    
	protected void takeOverEntityData(Object aOther) {
		if (aOther instanceof Ritual) {
			Ritual other 		= (Ritual) aOther;			
			this.name		= other.name;
			this.notizen	= other.notizen;
		}
	}

	@Override
	public IEditableEntity cloneEntity() {
		Ritual result = new Ritual();
		result.takeOverEntityData(this);
		return result;
	}

	@Override
	public PropertyChangeSupport getPropertyChangeSupport() {		
		return propertyChangeSupport;
	}

	@Override
	public void takeOverValuesFrom(IEditableEntity entity)
			throws IllegalArgumentException {
		if (entity instanceof Ritual) {
			Ritual other = (Ritual) entity;
			takeOverEntityData(other);
		}else{
			throw new IllegalArgumentException("Expected: "+Ritual.class+", Got: "+entity.getClass());
		}		
	}
    
    /**
     * Gets the value of the name property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setName(String value) {
    	if(value == null || value.equals(name))return;
		String oldName = name;
		name = value;
		propertyChangeSupport.fireIndexedPropertyChange("name", PCE_INDEX_Name, oldName, name);
    }

	/**
	 * @return the notizen
	 */
	public String getNotizen() {
		return notizen;
	}

	/**
	 * @param notizen the notizen to set
	 */
	public void setNotizen(String value) {
		if(value == null || value.equals(notizen))return;
		String oldNotizen = notizen;
		notizen = value;
		propertyChangeSupport.fireIndexedPropertyChange("notizen", PCE_INDEX_Notizen, oldNotizen, notizen);
	}

}
